package br.com.gerenciador_recursos.model;

import java.util.Set;

public class User {

	private int userId;

	private String screenName;
	
	private String firstName;
	
	private String lastName;

	private String emailAddress;

	private String password;
	
	private Set<UserType> userType;

	public User(int userId, String screenName, String firstName,
			String lastName, String emailAddress, String password,
			Set<UserType> userType) {
		super();
		this.userId = userId;
		this.screenName = screenName;
		this.firstName = firstName;
		this.lastName = lastName;
		this.emailAddress = emailAddress;
		this.password = password;
		this.userType = userType;
	}

	public int getUserCode() {
		return userId;
	}

	public void setUserCode(int userCode) {
		this.userId = userCode;
	}
	
	public String getFullName() {
		return firstName + " " + lastName;
	}

	public String getScreenName() {
		return screenName;
	}
	
	
	public void setScreeenName(String screenName) {
		this.screenName = screenName;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public Set<UserType> getUserType() {
		return userType;
	}

	public void setUserType(Set<UserType> userType) {
		this.userType = userType;
	}

	public String getEmailAddress() {
		return emailAddress;
	}

	public void setEmailAddress(String emailAddress) {
		this.emailAddress = emailAddress;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@Override
	public boolean equals(Object obj) {

		if(obj == null)
			return false;
		
		if(!(obj instanceof User))
			return false;
		
		User t = (User)obj;
		
		return this.userId == t.getUserCode();
	}
	
	@Override
	public int hashCode() {
		return this.userId * 7;
	}
	
}
